<!DOCTYPE html>
<html lang="zh-CN"  xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>课程过程化管理 </title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" th:href="@{/static/vendor/bootstrap/css/bootstrap.min.css}">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" th:href="@{/static/vendor/font-awesome/css/font-awesome.min.css}">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" th:href="@{/static/css/fontastic.css}">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" th:href="@{https://fonts.googleapis.com/css?family=Poppins:300,400,700}">
    <!-- theme stylesheet-->
    <link rel="stylesheet" th:href="@{/static/css/style.default.css}" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" th:href="@{/static/css/custom.css}">
    <!-- Favicon-->
    <link rel="shortcut icon" th:href="@{/static/img/favicon.ico}">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
    <script th:src="@{/static/js/echarts.min.js}"></script>
  </head>
  <body>
    <div class="page">
      <!-- Main Navbar-->
      <header class="header">
        <nav class="navbar">
          <!-- Search Box-->
          <div class="search-box">
            <button class="dismiss"><i class="icon-close"></i></button>
            <form id="searchForm" action="#" role="search">
              <input type="search" placeholder="What are you looking for..." class="form-control">
            </form>
          </div>
          <div class="container-fluid">
            <div class="navbar-holder d-flex align-items-center justify-content-between">
              <!-- Navbar Header-->
              <div class="navbar-header">
                <!-- Navbar Brand --><a href="index.html" class="navbar-brand d-none d-sm-inline-block">
                  <div class="brand-text d-none d-lg-inline-block"><strong>侧栏</strong></div>
                  <div class="brand-text d-none d-sm-inline-block d-lg-none"><strong>BD</strong></div></a>
                <!-- Toggle Button--><a id="toggle-btn" href="#" class="menu-btn active"><span></span><span></span><span></span></a>
              </div>
              <!-- Navbar Menu -->
              <ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
                <!-- Search-->
                <li class="nav-item d-flex align-items-center"><a id="search" href="#"><i class="icon-search"></i></a></li>
                <!-- Notifications-->
                <li class="nav-item dropdown"> <a id="notifications" rel="nofollow" data-target="#" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link"><i class="fa fa-bell-o"></i><span class="badge bg-red badge-corner">1</span></a>
                  <ul aria-labelledby="notifications" class="dropdown-menu">
                    <li><a rel="nofollow" href="#" class="dropdown-item"> 
                        <div class="notification">

                        </div></a></li>
                    <li><a rel="nofollow" href="#" class="dropdown-item all-notifications text-center"> <strong>view all notifications                                            </strong></a></li>
                  </ul>
                </li>
                <!-- Logout    -->
                <li class="nav-item"><a th:href="@{/logout}" class="nav-link logout"> <span class="d-none d-sm-inline">退出登录</span><i class="fa fa-sign-out"></i></a></li>
              </ul>
            </div>
          </div>
        </nav>
      </header>
      <div class="page-content d-flex align-items-stretch"> 
        <!-- Side Navbar -->
        <nav class="side-navbar">
          <!-- Sidebar Header-->
          <div class="sidebar-header d-flex align-items-center">
            <div class="avatar"><img th:src="@{/static/img/avatar-1.jpg}" alt="..." class="img-fluid rounded-circle"></div>
            <div class="title">
              <h1 class="h4" th:text="${session.Main.getTname()}"></h1>
              <p>老师编号：[[${session.loginUser}]]</p>
            </div>
          </div>
          <!-- Sidebar Navidation Menus--><span class="heading">Main</span>
          <ul class="list-unstyled">
                    <li><a th:href="@{/teachers/course/{cid}(cid=${courseID})}"> </i>章节信息 </a></li>
                    <li class="active"><a th:href="@{/teachers/grades/{cid}(cid=${courseID})}"></i>成绩情况 </a></li>
                    <li><a th:href="@{/teacherMain}"> <i class="icon-interface-windows"></i>返回教师主页 </a></li>
          </ul>
        </nav>
        <div class="content-inner">
          <!-- Page Header-->
          <header class="page-header">
            <div class="container-fluid">
              [[${cname}]]
            </div>
          </header>

          <br>

          <div id="main" style="width: 600px;height:400px;margin:0 auto;"></div>
          <script th:inline="javascript" type="text/javascript">
              /*<![CDATA[*/
              var chapter=[[${chapters}]];
              var score=[[${sum}]];
              //var averScore=[[${averSum}]];//不需要了，因为echarts自带
              /*]]>*/
              // 基于准备好的dom，初始化echarts实例
              var myChart = echarts.init(document.getElementById('main'));

              // 指定图表的配置项和数据
              option = {
                  title : {
                      text: [[${cname}]]+'成绩统计表',
                      subtext: '仅供参考'
                  },
                  tooltip : {
                      trigger: 'axis'
                  },
                  legend: {
                      data:['章节平均成绩']
                  },
                  toolbox: {
                      show : true,
                      feature : {
                          dataView : {show: true, readOnly: false},
                          magicType : {show: true, type: ['line', 'bar']},
                          restore : {show: false},
                          saveAsImage : {show: true}
                      }
                  },
                  calculable : true,
                  xAxis : [
                      {
                          type : 'category',
                          data : chapter
                      }
                  ],
                  yAxis : [
                      {
                          type : 'value'
                      }
                  ],
                  series : [
                      {
                          name:'章节平均成绩',
                          type:'bar',
                          data:score,
                          itemStyle : {
                              normal : {
                                  color: '#25beff'
                              }
                          },
                          markPoint : {
                              data : [
                                  {type : 'max', name: '最大值'},
                                  {type : 'min', name: '最小值'}
                              ]
                          },
                          markLine : {
                              data : [
                                  {type : 'average', name: '平均值'}
                              ],

                              lineStyle:{
                                  color:'black'
                              }

                          }
                      }
                  ]
              };


              // 使用刚指定的配置项和数据显示图表。
              myChart.setOption(option);
          </script>
          <!-- 柱状图    -->


          <style type="text/css">
            button  {
              background:#b5cfd2 url('css/bulecell.jpg');
            }
            tr.font {
              font-size: 20px;
            }
            table.imagetable {
              font-family: verdana,arial,sans-serif;
              font-size:11px;
              color:#333333;
              border-width: 1px;
              border-color: #999999;
              border-collapse: collapse;
            }
            table.imagetable th {
              background:#b5cfd2 url('css/bulecell.jpg');
              border-width: 1px;
              padding: 8px;
              border-style: solid;
              border-color: #999999;
            }
            table.imagetable td {
              background:#dcddc0 url('css/greycell.jpg');
              border-width: 1px;
              padding: 8px;
              border-style: solid;
              border-color: #999999;
            }
          </style>

          <!-- Page Footer-->
          <footer class="main-footer">
            <div class="container-fluid">
              <div class="row">
                <div class="col-sm-6">
                  <p>成都信息工程大学 &copy; 2019</p>
                </div>
              </div>
            </div>
          </footer>
        </div>
      </div>
    </div>
    <!-- JavaScript files-->
    <script th:src="@{/static/vendor/jquery/jquery.min.js}"></script>
    <script th:src="@{/static/vendor/popper.js/umd/popper.min.js}"> </script>
    <script th:src="@{/static/vendor/bootstrap/js/bootstrap.min.js}"></script>
    <script th:src="@{/static/vendor/jquery.cookie/jquery.cookie.js}"> </script>
    <script th:src="@{/static/vendor/chart.js/Chart.min.js}"></script>
    <script th:src="@{/static/vendor/jquery-validation/jquery.validate.min.js}"></script>
    <!-- Main File-->
    <script th:src="@{/static/js/front.js}"></script>
  </body>
</html>